# -*- coding: utf-8 -*-
"""
---------------------------------------
@File    ：server_main.py
@Author  ：liyunhui
@Date    ：2024/9/13 下午4:11 
@explain : 文件说明
---------------------------------------
"""
import sys
import warnings
from config import config
import tornado.httpserver
from application import Application
from urllib3.exceptions import InsecureRequestWarning
from sklearn.exceptions import InconsistentVersionWarning

# 忽略不安全请求警告
warnings.filterwarnings("ignore", category=InsecureRequestWarning)
# 忽略版本不一致警告
warnings.filterwarnings("ignore", category=InconsistentVersionWarning)


if __name__ == '__main__':
    app = Application()
    httpServer = tornado.httpserver.HTTPServer(app, decompress_request=True, idle_connection_timeout=200,
                                               body_timeout=200, no_keep_alive=False)
    httpServer.bind(config.options['port'])
    if sys.platform.startswith('win'):
        number = 1
    else:
        number = 5
    httpServer.start(number)
    tornado.ioloop.IOLoop.instance().start()
